import  mysql.connector

mydb = mysql.connector.connect(
    host="localhost",
    user="root",
    passwd="123456",
    database= "mybatis"
)

mycursor =  mydb.cursor()

sql = "insert into user (id, username, userage) values  (%s, %s, %s) "
val = ("8", "runnob" , "2")
mycursor.execute(sql, val)
mydb.commit()
print(mycursor.rowcount, "行插入")

